package com.fnzn.entranceGuard.feign;

import com.fnzn.entranceGuard.entity.User;
import com.fnzn.entranceGuard.msg.ObjectRestResponse;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author sxf
 * @date 2018/05/24
 */
//@FeignClient(name = "gate-way", fallback = UserInfoServiceFallbackImpl.class)
public interface UserInfoService {
    /**
     * 通过用户名查询用户、角色信息
     *
     * @param username 用户名
     * @return UserVo
     */
    @RequestMapping(value = "/user/get",method = RequestMethod.GET)
    List<User> get(@RequestParam("name") String username);

    /**
     * 通过openId查询用户、角色信息
     *
     * @param openId 用户名
     * @return UserVo
     */
    @RequestMapping(value = "/user/getByOpenId",method = RequestMethod.GET)
    List<User> getByOpenId(@RequestParam("openId") String openId);

    /**
     * 通过qqId查询用户、角色信息
     *
     * @param qqId 用户名
     * @return UserVo
     */
    @RequestMapping(value = "/user/getByQqId",method = RequestMethod.GET)
    List<User> getByQqId(@RequestParam("qqId") String qqId);

    /**
     * 注册用户
     *
     * @param user
     * @return
     */
    @RequestMapping(value = "/user/add", method = RequestMethod.POST)
    ObjectRestResponse<User> addUser(@RequestBody User user);

    /**
     * 第三方绑定用户
     *
     * @param user
     * @return
     */
    @RequestMapping(value = "/user/update", method = RequestMethod.PUT)
    ObjectRestResponse<User> updateUser(@RequestBody User user);

}
